Skip to content

temporal-sdk-migration [2/x]: temporal: support protobuf sharing with the official Ruby SDK - #9

Merged
yfang-figma merged 5 commits into
masterfrom
yfang/temporal-protobuf-coexistence
Nov 17, 2026
Merged

yfang-figma merged 5 commits into
masterfrom
yfang/temporal-protobuf-coexistence

Conversation

@yfang-figma

@yfang-figma yfang-figma commented Nov 3, 2026 •

Copy link
Copy Markdown

Written with AI

Let the official SDK own Temporal protobuf messages when COINBASE_TEMPORAL_RUBY_DISABLE_PROTO_LOAD=1. Keep Coinbase's Ruby gRPC stubs and preserve default Coinbase-only loading. Preserve the import guards after protobuf regeneration. This follows Coinbase PR 335.

Load the official API classes before the first Coinbase require. Set the option before that require. Sharing definitions changes field access and decoding, so application schema compatibility needs review before dual loading is enabled. Application boot, fork behavior, and worker polling belong to the dependent application PRs. The official gem is a test dependency only.

Why the follow-up commits are needed

  1. Preserve Coinbase's original protobuf import order. With upstream's order, the schedule-overlap serializer reads ScheduleOverlapPolicy before its protobuf definition loads. Removing this commit reproduced a Coinbase-only boot failure: NameError: uninitialized constant Temporalio::Api::Enums::V1::ScheduleOverlapPolicy. This commit loads the gRPC stubs and their protobuf dependencies before the serializers.

    The upstream PR description reports tests with both SDKs loaded together. When the official SDK loads first, the enum already exists. That loading sequence avoids this failure. The reproduced failure above concerns our fork with upstream's order; we did not run the complete, unmodified upstream SDK.

  2. Honor PROTO_OUT when guarding generated imports. The Makefile already supports a custom output directory, but upstream's guard step targets lib/gen. Use the configured directory so regenerated stubs retain the guards there too. This is needed when generation writes outside lib/gen, including the temporary-directory validation below.

  3. Add tests, CI coverage, and documentation. Upstream supplies the loading mechanism without regression tests. These additions check default loading and shared definitions with Coinbase serializers, workers, replay-helper imports, and both gRPC stubs. CI runs the loading probes with the test-only official SDK dependency. The test Gemfiles pin protobuf to 4.33.1 to match the application. The published dependency remains ~> 4.33.0. Documentation records the required load order and the separate application checks.

  4. Update CI to Ruby 3.4 and repair test fixtures. CI selected Ruby 3.0.3, but the fork's existing protobuf dependency requires Ruby 3.1 or later. Ruby 3.4 matches the application environment. Existing fixtures also need explicit OpenStruct loading, positional-hash workflow inputs, and support for qualified backtrace labels. These repairs preserve the existing behavioral assertions.

Test plan

  • BUNDLE_GEMFILE=Gemfile bundle exec rspec spec/unit: 647 examples, zero failures, one expected pending coexistence example.
  • BUNDLE_GEMFILE=gemfiles/temporalio.gemfile bundle exec rspec spec/unit: 647 examples, zero failures. The loading probes cover the default path, client-first boot, serializers, replay imports, workers, and both gRPC stubs.
  • After git submodule update --init --depth 1, run make proto PROTO_OUT=/tmp/temporal-pr2-generated with the coexistence Gemfile. Generation passes. Both regenerated stubs load against the official classes with the opt-in enabled.

Local unit checks used Ruby 3.4.12, temporalio 1.10.1, and google-protobuf 4.33.1. The earlier regeneration check used google-protobuf 4.33.6. CI also covers the example workflows against its Temporal server.

@yfang-figma yfang-figma changed the title temporal: support protobuf sharing with the official Ruby SDK temporal-sdk-migration [2/5]: temporal: support protobuf sharing with the official Ruby SDK Nov 4, 2026
@yfang-figma yfang-figma changed the title temporal-sdk-migration [2/5]: temporal: support protobuf sharing with the official Ruby SDK temporal-sdk-migration [2/x]: temporal: support protobuf sharing with the official Ruby SDK Nov 4, 2026
@yfang-figma
yfang-figma requested review from a team, kstewartfigma and michaelnyu and removed request for a team November 13, 2026 21:20
@yfang-figma
yfang-figma marked this pull request as ready for review November 13, 2026 21:20
@yfang-figma
yfang-figma force-pushed the yfang/temporal-protobuf-coexistence branch from 0f7c066 to a406677 Compare November 17, 2026 07:09
@yfang-figma
yfang-figma force-pushed the yfang/temporal-protobuf-coexistence branch from a406677 to 29327b5 Compare November 17, 2026 07:15

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

Reviewed by Cursor Bugbot for commit 29327b5. Configure here.

Comment thread Makefile

proto:
$(foreach PROTO_DIR,$(PROTO_DIRS),bundle exec grpc_tools_ruby_protoc -Iproto --ruby_out=$(PROTO_OUT) --grpc_out=$(PROTO_OUT) $(PROTO_DIR)*.proto;)
sed -i "/^require 'temporal\// s/$$/ unless ENV['COINBASE_TEMPORAL_RUBY_DISABLE_PROTO_LOAD'] == '1'/" $(PROTO_OUT)/temporal/api/workflowservice/v1/service_services_pb.rb $(PROTO_OUT)/temporal/api/operatorservice/v1/service_services_pb.rb

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Proto sed breaks on macOS

Low Severity

The new make proto step uses GNU sed -i with no backup suffix to re-apply the COINBASE_TEMPORAL_RUBY_DISABLE_PROTO_LOAD guards. BSD sed on macOS treats the script as a backup extension and fails after protoc has already overwritten service_services_pb.rb. Regeneration then leaves the gRPC stubs unguarded, so a later commit can drop coexistence support.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 29327b5. Configure here.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's ok.

@yfang-figma
yfang-figma force-pushed the yfang/temporal-protobuf-coexistence branch 2 times, most recently from a00938f to 29327b5 Compare November 17, 2026 07:49
@yfang-figma
yfang-figma force-pushed the yfang/temporal-protobuf-coexistence branch from 29327b5 to 34d2726 Compare November 17, 2026 08:38
@yfang-figma
yfang-figma merged commit cc03140 into master Nov 17, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants